import request from '@/utils/request'

// 查看已注册管理员信息列表
export const getRegistered = ({ page, size, adminEmail, adminName, roleName }) => {
  return request.get('/systemUser/admin/list', {
    params: {
      page,
      size,
      adminEmail,
      adminName,
      roleName
    }
  })
}

// 查看未注册管理员信息
export const getUnRegister = ({ page, size, adminEmail, adminName, roleName }) => {
  return request.get('/systemUser/unadmin/list', {
    params: {
      page,
      size,
      adminEmail,
      adminName,
      roleName
    }
  })
}

// 添加

export const addAdmin = ({ adminEmail, adminName, adminRole }) => {
  return request.post('/systemUser/add', {
    adminEmail,
    adminName,
    adminRole
  })
}

// 查看所有管理员信息
export const getAllAdmin = ({ page, size, adminEmail, adminName, roleName }) => {
  return request.get('/systemUser/all/list', {
    params: {
      page,
      size,
      adminEmail,
      adminName,
      roleName
    }
  })
}

// 已经注册表的删除
export const registeredDelete = ({ email, roleName }) => {
  return request.post('/systemUser/delete', null, {
    params: {
      email,
      roleName

    }
  })
}

// 未注册表的删除
export const UnRegisterDelete = ({ email }) => {
  return request.get('/systemUser/nodelete', {
    params: {
      email
    }
  })
}

// 获取职位下拉框
export const getRolelist = () => {
  return request.get('/systemUser/all/rolelist')
}

// 已经注册表的编辑
export const update = ({ adminEmail, roleName }) => {
  return request.post('/systemUser/update', {

    adminEmail,
    roleName

  })
}

// 未注册表的编辑
export const noupdate = ({ adminEmail, roleName }) => {
  return request.post('/systemUser/noupdate', {

    adminEmail,
    roleName

  })
}

// 导出
export const daochu = ({ listEmail, timeZone }) => {
  return request.get('/systemUser/export', {
    params: {
      listEmail,
      timeZone
    },
    responseType: 'blob'
  })
}

// 重发

export const chongfa = ({ email }) => {
  return request.get('/systemUser/addAgain', {
    params: {
      email
    }
  })
}

// 管理员日志api

// 管理日志列表查看
export const viewLogList = ({ params }) => {
  // console.log(params)
  return request.get('/system/operationLog', {
    params
  })
}
// 模糊查询操作人列表
export const searchPerson = (params) => {
  return request.get('/system/person', {
    params
  })
}
// 操作模块下拉框展示
export const getSelection = () => {
  return request.get('/system/tree')
}
// 职位下拉框展示
export const getPost = () => {
  return request.get('/system/post')
}
// 职位管理模块
// 分页显示职位信息列表
export const getPositionList = (params) => {
  return request.get('/position/list', {
    params
  })
}
// 添加职位 ----将添加信息存数据库中
export const addPosition = (params) => {
  return request.post('/position/add', {
    ...params
  })
}

// 添加职位-----先查看职位间的从属关系
export const positionSelect = () => {
  return request.get('/position/select')
}
// 删除职位
export const deletePosition = (params) => {
  return request.get('/position/del', {
    params
  })
}
// 编辑职位 ---将修改后的职位信息保存
export const editPositon = (params) => {
  return request.post('/position/perm/save', {
    ...params
  })
}
// 编辑职位 ---先查看职位之间分级信息以及该职位其他信息
export const positionByEdit = (params) => {
  return request.get('/position/update', {
    params
  })
}
